package com.gjs.sso.config;

import com.gjs.common.manager.SmsVerifyCode;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

@Configuration
@Order(1)
public class SmsValidCodeConfig {

    @Value("${register.cache-key}")
    private String registerCacheKey;

    @Value("${register.expire}")
    private Long registerExpire;

    @Value("${login.cache-key}")
    private String loginCacheKey;

    @Value("${login.expire}")
    private Long loginExpire;

    @Bean
    public SmsVerifyCode smsValidCode(){
        SmsVerifyCode smsVerifyCode = new SmsVerifyCode();
        smsVerifyCode.setRegisterCacheKey(registerCacheKey);
        smsVerifyCode.setRegisterExpire(registerExpire);
        smsVerifyCode.setLoginCacheKey(loginCacheKey);
        smsVerifyCode.setLoginExpire(loginExpire);
        return smsVerifyCode;
    }
}
